home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / print / ServiceDialog$JobAttributesPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  5.6 KB  |  196 lines

  1. package sun.print;
  2.  
  3. import java.awt.GridBagConstraints;
  4. import java.awt.GridBagLayout;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import java.awt.event.FocusEvent;
  8. import java.awt.event.FocusListener;
  9. import java.util.Locale;
  10. import javax.print.attribute.standard.JobName;
  11. import javax.print.attribute.standard.JobPriority;
  12. import javax.print.attribute.standard.JobSheets;
  13. import javax.print.attribute.standard.RequestingUserName;
  14. import javax.swing.BorderFactory;
  15. import javax.swing.JCheckBox;
  16. import javax.swing.JLabel;
  17. import javax.swing.JPanel;
  18. import javax.swing.JSpinner;
  19. import javax.swing.JTextField;
  20. import javax.swing.SpinnerNumberModel;
  21. import javax.swing.event.ChangeEvent;
  22. import javax.swing.event.ChangeListener;
  23.  
  24. class ServiceDialog$JobAttributesPanel extends JPanel implements ActionListener, ChangeListener, FocusListener {
  25.    private final String strTitle;
  26.    private JLabel lblPriority;
  27.    private JLabel lblJobName;
  28.    private JLabel lblUserName;
  29.    private JSpinner spinPriority;
  30.    private SpinnerNumberModel snModel;
  31.    private JCheckBox cbJobSheets;
  32.    private JTextField tfJobName;
  33.    private JTextField tfUserName;
  34.    // $FF: synthetic field
  35.    final ServiceDialog this$0;
  36.  
  37.    public ServiceDialog$JobAttributesPanel(ServiceDialog var1) {
  38.       this.this$0 = var1;
  39.       this.strTitle = ServiceDialog.getMsg("border.jobattributes");
  40.       GridBagLayout var2 = new GridBagLayout();
  41.       GridBagConstraints var3 = new GridBagConstraints();
  42.       this.setLayout(var2);
  43.       this.setBorder(BorderFactory.createTitledBorder(this.strTitle));
  44.       var3.fill = 0;
  45.       var3.insets = ServiceDialog.access$700();
  46.       var3.weighty = (double)1.0F;
  47.       this.cbJobSheets = ServiceDialog.access$1000("checkbox.jobsheets", this);
  48.       var3.anchor = 21;
  49.       ServiceDialog.access$300(this.cbJobSheets, this, var2, var3);
  50.       JPanel var4 = new JPanel();
  51.       this.lblPriority = new JLabel(ServiceDialog.getMsg("label.priority"), 11);
  52.       this.lblPriority.setDisplayedMnemonic(ServiceDialog.access$800("label.priority"));
  53.       var4.add(this.lblPriority);
  54.       this.snModel = new SpinnerNumberModel(1, 1, 100, 1);
  55.       this.spinPriority = new JSpinner(this.snModel);
  56.       this.lblPriority.setLabelFor(this.spinPriority);
  57.       ((JSpinner.NumberEditor)this.spinPriority.getEditor()).getTextField().setColumns(3);
  58.       this.spinPriority.addChangeListener(this);
  59.       var4.add(this.spinPriority);
  60.       var3.anchor = 22;
  61.       var3.gridwidth = 0;
  62.       var4.getAccessibleContext().setAccessibleName(ServiceDialog.getMsg("label.priority"));
  63.       ServiceDialog.access$300(var4, this, var2, var3);
  64.       var3.fill = 2;
  65.       var3.anchor = 10;
  66.       var3.weightx = (double)0.0F;
  67.       var3.gridwidth = 1;
  68.       char var5 = ServiceDialog.access$800("label.jobname");
  69.       this.lblJobName = new JLabel(ServiceDialog.getMsg("label.jobname"), 11);
  70.       this.lblJobName.setDisplayedMnemonic(var5);
  71.       ServiceDialog.access$300(this.lblJobName, this, var2, var3);
  72.       var3.weightx = (double)1.0F;
  73.       var3.gridwidth = 0;
  74.       this.tfJobName = new JTextField();
  75.       this.lblJobName.setLabelFor(this.tfJobName);
  76.       this.tfJobName.addFocusListener(this);
  77.       this.tfJobName.setFocusAccelerator(var5);
  78.       this.tfJobName.getAccessibleContext().setAccessibleName(ServiceDialog.getMsg("label.jobname"));
  79.       ServiceDialog.access$300(this.tfJobName, this, var2, var3);
  80.       var3.weightx = (double)0.0F;
  81.       var3.gridwidth = 1;
  82.       char var6 = ServiceDialog.access$800("label.username");
  83.       this.lblUserName = new JLabel(ServiceDialog.getMsg("label.username"), 11);
  84.       this.lblUserName.setDisplayedMnemonic(var6);
  85.       ServiceDialog.access$300(this.lblUserName, this, var2, var3);
  86.       var3.gridwidth = 0;
  87.       this.tfUserName = new JTextField();
  88.       this.lblUserName.setLabelFor(this.tfUserName);
  89.       this.tfUserName.addFocusListener(this);
  90.       this.tfUserName.setFocusAccelerator(var6);
  91.       this.tfUserName.getAccessibleContext().setAccessibleName(ServiceDialog.getMsg("label.username"));
  92.       ServiceDialog.access$300(this.tfUserName, this, var2, var3);
  93.    }
  94.  
  95.    public void actionPerformed(ActionEvent var1) {
  96.       if (this.cbJobSheets.isSelected()) {
  97.          ServiceDialog.access$1200(this.this$0).add(JobSheets.STANDARD);
  98.       } else {
  99.          ServiceDialog.access$1200(this.this$0).add(JobSheets.NONE);
  100.       }
  101.  
  102.    }
  103.  
  104.    public void stateChanged(ChangeEvent var1) {
  105.       ServiceDialog.access$1200(this.this$0).add(new JobPriority(this.snModel.getNumber().intValue()));
  106.    }
  107.  
  108.    public void focusLost(FocusEvent var1) {
  109.       Object var2 = var1.getSource();
  110.       if (var2 == this.tfJobName) {
  111.          ServiceDialog.access$1200(this.this$0).add(new JobName(this.tfJobName.getText(), Locale.getDefault()));
  112.       } else if (var2 == this.tfUserName) {
  113.          ServiceDialog.access$1200(this.this$0).add(new RequestingUserName(this.tfUserName.getText(), Locale.getDefault()));
  114.       }
  115.  
  116.    }
  117.  
  118.    public void focusGained(FocusEvent var1) {
  119.    }
  120.  
  121.    public void updateInfo() {
  122.       Class var1 = JobSheets.class;
  123.       Class var2 = JobPriority.class;
  124.       Class var3 = JobName.class;
  125.       Class var4 = RequestingUserName.class;
  126.       boolean var5 = false;
  127.       boolean var6 = false;
  128.       boolean var7 = false;
  129.       boolean var8 = false;
  130.       if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var1)) {
  131.          var5 = true;
  132.       }
  133.  
  134.       JobSheets var9 = (JobSheets)ServiceDialog.access$1200(this.this$0).get(var1);
  135.       if (var9 == null) {
  136.          var9 = (JobSheets)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var1);
  137.          if (var9 == null) {
  138.             var9 = JobSheets.NONE;
  139.          }
  140.       }
  141.  
  142.       this.cbJobSheets.setSelected(var9 != JobSheets.NONE);
  143.       this.cbJobSheets.setEnabled(var5);
  144.       if (!ServiceDialog.access$1500(this.this$0) && ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var2)) {
  145.          var6 = true;
  146.       }
  147.  
  148.       JobPriority var10 = (JobPriority)ServiceDialog.access$1200(this.this$0).get(var2);
  149.       if (var10 == null) {
  150.          var10 = (JobPriority)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var2);
  151.          if (var10 == null) {
  152.             var10 = new JobPriority(1);
  153.          }
  154.       }
  155.  
  156.       int var11 = var10.getValue();
  157.       if (var11 < 1 || var11 > 100) {
  158.          var11 = 1;
  159.       }
  160.  
  161.       this.snModel.setValue(new Integer(var11));
  162.       this.lblPriority.setEnabled(var6);
  163.       this.spinPriority.setEnabled(var6);
  164.       if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var3)) {
  165.          var7 = true;
  166.       }
  167.  
  168.       JobName var12 = (JobName)ServiceDialog.access$1200(this.this$0).get(var3);
  169.       if (var12 == null) {
  170.          var12 = (JobName)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var3);
  171.          if (var12 == null) {
  172.             var12 = new JobName("", Locale.getDefault());
  173.          }
  174.       }
  175.  
  176.       this.tfJobName.setText(var12.getValue());
  177.       this.tfJobName.setEnabled(var7);
  178.       this.lblJobName.setEnabled(var7);
  179.       if (!ServiceDialog.access$1500(this.this$0) && ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var4)) {
  180.          var8 = true;
  181.       }
  182.  
  183.       RequestingUserName var13 = (RequestingUserName)ServiceDialog.access$1200(this.this$0).get(var4);
  184.       if (var13 == null) {
  185.          var13 = (RequestingUserName)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var4);
  186.          if (var13 == null) {
  187.             var13 = new RequestingUserName("", Locale.getDefault());
  188.          }
  189.       }
  190.  
  191.       this.tfUserName.setText(var13.getValue());
  192.       this.tfUserName.setEnabled(var8);
  193.       this.lblUserName.setEnabled(var8);
  194.    }
  195. }
  196.